<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../react18/react.development.js"></script>
    <script src="../react18/react-dom.development.js"></script>
    <script src="../react18/babel.min.js"></script>
</head>

<body>
    <div id="app"></div>
    <script type="text/babel">

        //字符串形式的refs.值是字符串
        //组件实例上会有一个ref对象,对象中you

        class App extends React.Component{


            render(){
                // ref={(c,a,b)=>{console.log(c,a,b);}}
                //传递三个参数,第一个参数就是input
                return(
                    <div>
                    <button onClick ={this.handle}>点击弹出输入框内容</button>
                    <input type="text" ref={(c)=>this.oIpt=c}/>    
                    </div>
                )
            }

            handle=()=>{
                console.log(this);
                // const{value} = this
                const{value}= this.oIpt
                console.log(value);
                alert(value)
            }

        }

        const root = ReactDOM.createRoot(document.getElementById('app'));
        root.render(<App />)
  </script>
</body>

</html>